package com.atguigu.lease.web.admin.service.impl;

import com.atguigu.lease.model.entity.SystemUser;
import com.atguigu.lease.web.admin.mapper.SystemUserMapper;
import com.atguigu.lease.web.admin.service.SystemUserService;
import com.atguigu.lease.web.admin.vo.system.user.SystemUserInfoVo;
import com.atguigu.lease.web.admin.vo.system.user.SystemUserItemVo;
import com.atguigu.lease.web.admin.vo.system.user.SystemUserQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author liubo
 * @description 针对表【system_user(员工信息表)】的数据库操作Service实现
 * @createDate 2023-07-24 15:48:00
 */
@Service
public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUser>
        implements SystemUserService {
    @Autowired
    SystemUserMapper systemUserMapper;

    @Override
    public IPage<SystemUserItemVo> pageItem(Page<SystemUserItemVo> systemUserItemVoPage, SystemUserQueryVo queryVo) {
        return systemUserMapper.pageItem(systemUserItemVoPage, queryVo);
    }

    @Override
    public SystemUserItemVo getInfoById(Long id) {
        return systemUserMapper.getInfoById(id);
    }

    @Override
    public SystemUserInfoVo info(Long userId) {
        System.out.println("userId123456781234567812345678 = " + userId);
        SystemUserInfoVo systemUserInfoVo = new SystemUserInfoVo();
        SystemUser systemUser = this.getById(userId);
        systemUserInfoVo.setName(systemUser.getName());
        systemUserInfoVo.setAvatarUrl(systemUserInfoVo.getAvatarUrl());
        return systemUserInfoVo;
    }
}




